'use strict';
define(function(require, exports, module) {

	exports.init = function(app) {
		app.register.service("registerService", ['$http', function($http) {
			return {
				queryList: function(func) {
					$http({
						method: "GET",
						url: "./app/test/data/user.json"
					}).then(function(resp) {
						if (typeof func == 'function') func(resp.data);
					});
				},

				queryById: function(id, func) {
					$http({
						method: "GET",
						url: "./app/test/data/user.json"
					}).then(function(resp) {
						var o = null;
						angular.forEach(resp.data, function(obj) {
							if (obj.id == id) {
								o = obj;
								return;
							}
						});
						if (typeof func == 'function') func(o);
					});
				}
			};

		}]);
	};

});